-
Notifications
You must be signed in to change notification settings - Fork 47
EIP-7823 and EIP-7883 implementation --- Osaka MODEXP changes
#2477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EIP-7823 and EIP-7883 implementation --- Osaka MODEXP changes
#2477
Conversation
...ensys/linea/zktracer/module/hub/section/call/precompileSubsection/OsakaModexpSubsection.java
Show resolved
Hide resolved
...ktracer/module/hub/fragment/imc/oob/precompiles/modexp/xbsOobCall/OsakaModexpXbsOobCall.java
Show resolved
Hide resolved
...sensys/linea/zktracer/module/hub/section/call/precompileSubsection/PrecompileSubsection.java
Show resolved
Hide resolved
...tization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/mmu/MmuCall.java
Show resolved
Hide resolved
...net/consensys/linea/zktracer/module/hub/precompiles/modexpMetadata/LondonModexpMetadata.java
Show resolved
Hide resolved
...n/java/net/consensys/linea/zktracer/module/blake2fmodexpdata/LondonBlakeModexpOperation.java
Outdated
Show resolved
Hide resolved
arithmetization/src/main/java/net/consensys/linea/zktracer/ZkCounter.java
Outdated
Show resolved
Hide resolved
One failing test (MODEXP limits)
the old tests were overwriting mbs in memory !
...ensys/linea/zktracer/module/hub/section/call/precompileSubsection/OsakaModexpSubsection.java
Show resolved
Hide resolved
...ensys/linea/zktracer/module/hub/section/call/precompileSubsection/OsakaModexpSubsection.java
Show resolved
Hide resolved
...module/hub/fragment/imc/oob/precompiles/modexp/pricingOobCall/OsakaModexpPricingOobCall.java
Show resolved
Hide resolved
...ensys/linea/zktracer/module/hub/section/call/precompileSubsection/OsakaModexpSubsection.java
Outdated
Show resolved
Hide resolved
...ensys/linea/zktracer/module/hub/section/call/precompileSubsection/OsakaModexpSubsection.java
Outdated
Show resolved
Hide resolved
...ensys/linea/zktracer/module/hub/section/call/precompileSubsection/OsakaModexpSubsection.java
Outdated
Show resolved
Hide resolved
...nsys/linea/zktracer/module/hub/section/call/precompileSubsection/LondonModexpSubsection.java
Show resolved
Hide resolved
...nsys/linea/zktracer/module/hub/section/call/precompileSubsection/LondonModexpSubsection.java
Show resolved
Hide resolved
...nsys/linea/zktracer/module/hub/section/call/precompileSubsection/LondonModexpSubsection.java
Show resolved
Hide resolved
...ion/src/main/java/net/consensys/linea/zktracer/module/blake2fmodexpdata/BlakeComponents.java
Outdated
Show resolved
Hide resolved
...ion/src/main/java/net/consensys/linea/zktracer/module/blake2fmodexpdata/BlakeModexpData.java
Show resolved
Hide resolved
...ain/java/net/consensys/linea/zktracer/module/blake2fmodexpdata/BlakeModexpDataOperation.java
Show resolved
Hide resolved
...c/main/java/net/consensys/linea/zktracer/module/blake2fmodexpdata/LondonBlakeModexpData.java
Outdated
Show resolved
Hide resolved
...tization/src/main/java/net/consensys/linea/zktracer/module/hub/fragment/imc/mmu/MmuCall.java
Show resolved
Hide resolved
arithmetization/src/main/java/net/consensys/linea/zktracer/module/hub/Hub.java
Show resolved
Hide resolved
...test/java/net/consensys/linea/zktracer/module/limits/precompileLimits/ModexpLimitsTests.java
Outdated
Show resolved
Hide resolved
testing/src/main/java/net/consensys/linea/reporting/TracerTestBase.java
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| protected boolean allXbsesAreInBounds() { | ||
| return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Missing maxNumberOfLines override in LondonModexpSubsection
The LondonModexpSubsection class doesn't override the maxNumberOfLines() method that was present in the original ModexpSubsection class. This causes it to inherit the default implementation from PrecompileSubsection which returns 0, instead of the correct value NB_ROWS_HUB_PRC_MODEXP (13). This affects line counting for MODEXP precompile operations and could lead to incorrect trace sizing calculations.
…tyThreeSixtyFourthsPrecompileTests
| } | ||
|
|
||
| protected boolean allXbsesAreInBounds() { | ||
| return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Missing maxNumberOfLines override in LondonModexpSubsection
The LondonModexpSubsection class was refactored from ModexpSubsection but the maxNumberOfLines() method override was removed. The diff shows the old ModexpSubsection had this method returning NB_ROWS_HUB_PRC_MODEXP (value 13), but the new LondonModexpSubsection doesn't override it, causing it to inherit the default return value of 0 from PrecompileSubsection. This breaks the precompile subsection initialization in the constructor which calls new ArrayList<>(maxNumberOfLines()), potentially causing incorrect memory allocation and fragment list sizing for MODEXP operations.
9ffa4a4 to
8ce1623
Compare
|
|
||
| public short getNumberOfRowsForModexp() { | ||
| return (short) (4 * (getMaxInputSize() / LLARGE)); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Mismatch between row count formula and actual indices
The getNumberOfRowsForModexp() method calculates rows as 4 * (getMaxInputSize() / LLARGE), assuming all four MODEXP phases have equal-sized index arrays. However, the actual row count depends on INDEX_MAX_MODEXP_BASE, INDEX_MAX_MODEXP_EXPONENT, INDEX_MAX_MODEXP_MODULUS, and INDEX_MAX_MODEXP_RESULT constants from fork-specific Trace classes. If these constants aren't uniformly derived from getMaxInputSize() / LLARGE, this formula produces incorrect line counts, leading to miscounting in blakemodexp.updateTally() calls in ZkCounter.tracePrecompileCall().
|
|
||
| return tracerSharedConfiguration.isLimitless() | ||
| ? new ZkCounter(l1L2BridgeSharedConfiguration) | ||
| ? new ZkCounter(l1L2BridgeSharedConfiguration, fork) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will require a PR in the monorepo as well to change the ZkCounter interface, everywhere ZkCounter is called https://github.com/Consensys/linea-monorepo/blob/5aed83a5f904a1b19906dac4aa0d45656074dfd3/besu-plugins/linea-sequencer/sequencer/src/main/java/net/consensys/linea/rpc/methods/LineaEstimateGas.java#L437 - might also be the case for Besu-shomei plugin
Signed-off-by: F Bojarski <[email protected]>
letypequividelespoubelles
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…2477) * feat: constraints update * constraints update * first commit * various ... * stuff ... * clean up With Lorenzo and François * fix: 99% up to par + @EqualsAndHash(callSuper = true) One failing test (MODEXP limits) * fix: ModexpTests the old tests were overwriting mbs in memory ! * feat: fix ZkCounter event detection * spotless * spotless ... again ? * feat: Osaka MODEXP pricing OOB call * stuff * spotless * setting TOT in MODEXP's MMU instructions (DATA and ZERO) * small stuff * bug: use OsakaBlakeModexpOperation for Osaka rather than LondonBla * feat: most tests are passing * feat: constraints update * merge arith-dev * constraints update * feat: byteMultiplier of leadLog in MODEXP made fork dependent leadLog is essentially defined as log_2(exponent_leading_word) + multiplier * (ebs - 32) with multiplier = 8 pre-Osaka, and 16 post-Osaka * feat: ugly test fixes * feat: fork dependent MODEXP_PRICING byte multiplier m * (ebs - 32) * feat: fork dependent xbsNonzero for MODEXP_XBS * ras: constraints commit update * feat: add fork field to ZkCounter class * spotless * fix: use fork appropriate gasLimit in LowGasStipendPrecompileCallTests * fix: disable parallelism (enabled by mistake) * wip: fix of huge gas consumption in 'preCallProgramGasMap' * added meaningful input for call to POINT_EVALUATION precompile in SixtyThreeSixtyFourthsPrecompileTests * fix: initialize KZG * constraints update * ras: TracerTestBase now on OSAKA * review comments * update constraints Signed-off-by: F Bojarski <[email protected]> --------- Signed-off-by: F Bojarski <[email protected]> Co-authored-by: Lorenzo Gentile <[email protected]> Co-authored-by: F Bojarski <[email protected]> Co-authored-by: François Bojarski <[email protected]>
Note
Implements fork-aware MODEXP per Osaka (EIP‑7823), introducing London/Osaka MODEXP metadata, pricing and XBS OOB calls, updating MMU and counters to fork-specific sizes/costs, wiring fork into ZkCounter via RPC, and adjusting tests.
ZkCounterfork-aware; deriveOpCodes/Tracefromforkand use fork in MODEXP logic and line counts.LondonModexpSubsection/OsakaModexpSubsection, withLondon/OsakaModexpMetadata.London/OsakaBlakeModexpDataOperation,London/OsakaModexpPricingOobCall,London/OsakaModexpXbsOobCall.forkintoMmu/MmuInstructions; adjustModexpData/ModexpZeromicro-rows and component sizes per fork.ModexpMetadata.getNumberOfRowsForModexp(); make MODEXP success depend on forked bounds and pricing.BlakeModexpDataAPI.GenerateLineCountsV2andConflatedCountTracesV2: constructZkCounterwith resolvedfork.Written by Cursor Bugbot for commit 2fedec6. This will update automatically on new commits. Configure here.